package com.hundredapp.oa.repository;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.hundredapp.oa.dao.GenericDao;
import com.hundredapp.oa.domain.OaElect;

@Repository
public class ElectManagerImpl implements ElectManager{

	@Autowired
	private GenericDao<OaElect, Integer> electDao;

	@Override
	public OaElect findById(Integer id) {
		return electDao.findById(id);
	}

	@Override
	public void add(OaElect elect) {
		electDao.save(elect);
	}

	@Override
	public List<OaElect> findByContract(Integer contractId) {
		return electDao.find(" oaContract.id = "+contractId);
	}

	@Override
	public List<OaElect> findBySubject(Integer subjectId) {
		return electDao.find(" oaSubject.id = "+subjectId);
	}
	
	
}
